<html>
<head><meta charset="utf-8"><title>ProjectionTy also works for consts? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/ProjectionTy.20also.20works.20for.20consts.3F.html">ProjectionTy also works for consts?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247758140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/ProjectionTy%20also%20works%20for%20consts%3F/near/247758140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/ProjectionTy.20also.20works.20for.20consts.3F.html#247758140">(Jul 30 2021 at 20:32)</a>:</h4>
<p>I was looking at <code>ProjectionPredicates</code>, and see that <code>println!("{}", &lt;T as Foo&gt;::N)</code> where N is an associated const works fine but couldn't find a <code>ProjectionConst</code> struct, and was wondering if <code>ProjectionTy</code> is both for consts and types?</p>



<a name="247759277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/ProjectionTy%20also%20works%20for%20consts%3F/near/247759277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/ProjectionTy.20also.20works.20for.20consts.3F.html#247759277">(Jul 30 2021 at 20:42)</a>:</h4>
<p>I believe <code>ProjectionTy</code> is only used when a projection is used <em>as</em> a type</p>



<a name="247759295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/ProjectionTy%20also%20works%20for%20consts%3F/near/247759295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/ProjectionTy.20also.20works.20for.20consts.3F.html#247759295">(Jul 30 2021 at 20:42)</a>:</h4>
<p>here it's just an expression</p>



<a name="247759496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/ProjectionTy%20also%20works%20for%20consts%3F/near/247759496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/ProjectionTy.20also.20works.20for.20consts.3F.html#247759496">(Jul 30 2021 at 20:44)</a>:</h4>
<p>hmmmm makes sense, I don't really see anything specific to types in ProjectionTy tho so I'm wondering if I can just repurpose it for consts whenever it uses the DefId stored on it. Or would it be better to make something else for that?</p>



<a name="247759600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/ProjectionTy%20also%20works%20for%20consts%3F/near/247759600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jknodt <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/ProjectionTy.20also.20works.20for.20consts.3F.html#247759600">(Jul 30 2021 at 20:45)</a>:</h4>
<p>(the end goal is to permit <code>T: Trait&lt;AssocConst = 3&gt;</code>)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>